package top.feiskyend.core.utils;

import org.springframework.util.DigestUtils;

import java.util.UUID;

/**
 * @author: YTF
 * @date: 2022/9/13 12:31
 * @version: 1.0
 * @email: 1712310435@qq.com
 * @description:
 */
public class CommonUtil {

    /**
     * 生成字符串UUID
     * @return UUID
     */
    public static String generateUUID(){
        return UUID.randomUUID().toString().replaceAll("-","");
    }

    /**
     * MD5加密
     * @param key 加密字符串
     * @return 加密后字符串
     */
    public static String md5(String key){
        return DigestUtils.md5DigestAsHex(key.getBytes());
    }
}
